package com.ikun.yummy.sourceop.sqlutils;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
import com.ikun.yummy.properties.AppProperties;
public class SqliteHelper extends SQLiteOpenHelper {
    private static final String CREATE_USER_TABLE = "create table "+ AppProperties.USER_TABLE + " (userid integer primary key autoincrement, username varchar(20), password varchar(20), loginstate varchar(20), userimage TEXT, email varchar(20))";
    private static final String CREATE_COOK_TABLE = "create table "+ AppProperties.COOK_TABLE + " (cookid integer primary key autoincrement, cookname varchar(20), username varchar(20), coverimage TEXT, ingredients TEXT, step TEXT, time varchar(20), difficulty varchar(20), taste varchar(20), classification varchar(20), cookstory TEXT)";
    private static final String CREATE_LIKE_TABLE = "create table "+ AppProperties.LIKE_TABLE + " (likeid integer primary key autoincrement, username varchar(20), cookname varchar(20), cookid varchar(20))";
    private static final String CREATE_COMMENT_TABLE = "create table "+ AppProperties.COMMENT_TABLE + " (commentid  integer primary key autoincrement, username varchar(20), content TEXT,reply TEXT,cookid varchar(20))";
    //关注
    private static final String CREATE_FOLLOWER_TABLE = "create table "+ AppProperties.FOLLOWER_TABLE + " (followerid  integer primary key autoincrement,username varchar(20),othername varchar(20))";
    //粉丝
    private static final String CREATE_FOLLOWEE_TABLE = "create table "+ AppProperties.FOLLOWEE_TABLE + " (followeeid  integer primary key autoincrement,username varchar(20),othername varchar(20))";
    public SqliteHelper(@Nullable Context context) {
        super(context, "yummy.db", null, 2);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_USER_TABLE);
        db.execSQL(CREATE_COOK_TABLE);
        db.execSQL(CREATE_LIKE_TABLE);
        db.execSQL(CREATE_COMMENT_TABLE);
        db.execSQL(CREATE_FOLLOWEE_TABLE);
        db.execSQL(CREATE_FOLLOWER_TABLE);
    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int i, int i1) {
    }
}
